package com.ms.service.message;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public abstract class BaseMessage {
	
	public abstract String toString();
	
	public String printClass(Object object){
		Class<?> superClz = object.getClass();
		StringBuilder result = new StringBuilder();
		
		for (Field field : superClz.getDeclaredFields()) {
			if (!Modifier.isFinal(field.getModifiers()) && !Modifier.isStatic(field.getModifiers())
					&& !Modifier.isTransient(field.getModifiers())) {
			try {
				result.append(" | ");
				result.append(field.getName()).append(":").append(field.get(object));
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			}
		}
		
		return result.toString();
	}
	
}
